package com.ihighest.app.infox.myview;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ihighest.app.infox.R;

public class ImgSecondTextView extends RelativeLayout {
	private TextView itemName;
	private TextView itemSecondName;
	private ImageView img;

	public ImgSecondTextView(Context context, AttributeSet attrs, String name, boolean icheck) {
		super(context, attrs);
		initView(context);
		TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ImgSecondTextView);
		String itemName = a.getString(R.styleable.ImgSecondTextView_imgItemFirstName);
		String secondName = a.getString(R.styleable.ImgSecondTextView_imgItemSecondName);
		img.setImageDrawable(a.getDrawable(R.styleable.ImgSecondTextView_fistImgPath));
		setItemName(itemName);
		setSecondName(secondName);
		// Constants.changeSize(context, this, true);
		a.recycle();
	}

	public ImgSecondTextView(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);
		// Constants.changeSize(context, this, true);
	}

	public ImgSecondTextView(Context context, AttributeSet attrs) {
		super(context, attrs);
		initView(context);
		TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ImgSecondTextView);
		String itemName = a.getString(R.styleable.ImgSecondTextView_imgItemFirstName);
		String secondName = a.getString(R.styleable.ImgSecondTextView_imgItemSecondName);
		img.setImageDrawable(a.getDrawable(R.styleable.ImgSecondTextView_fistImgPath));

		setItemName(itemName);
		setSecondName(secondName);
		// Constants.changeSize(context, this, true);
		a.recycle();
	}

	/**
	 * 设置条目
	 * 
	 * @param itemName
	 * 
	 * @author lkx Created at 2015-10-5 上午9:14:08
	 */
	private void setItemName(String name) {
		itemName.setText(name);

	}

	/**
	 * 设置第二个textview
	 * 
	 * @param itemName
	 * 
	 * @author lkx Created at 2015-10-5 上午9:14:08
	 */
	private void setSecondName(String name) {
		itemSecondName.setText(name);

	}

	public ImgSecondTextView(Context context) {
		super(context);
		initView(context);
	}

	/**
	 * 初始化绑定控件
	 * 
	 * @param context
	 * 
	 * @author lkx Created at 2015-10-5 上午8:58:56
	 */
	private void initView(Context context) {
		View view = View.inflate(context, R.layout.infox_myview_imgsecondtext, this);
		itemName = (TextView) view.findViewById(R.id.mImgSecondFirstName);
		itemName.setTextSize(16.0f);
		img = (ImageView) view.findViewById(R.id.mImgSecondImgPath);
		itemSecondName = (TextView) view.findViewById(R.id.mImgSecondSecondName);
		itemSecondName.setTextSize(14.0f);
	}

}
